*******************************************************
* Lyle 05 Jan 11: 						              *
*	-this program serves as a base shell for all	  *
*	 stata do files					                  *
*******************************************************


********************************
* Standard Stata Configuration *
********************************
clear all
set mem 999m
capture log close
set logtype text
cap cd "C:\Users\ejm5\Google Drive\2016_Research\Unemployment_MILEX"
cap cd "C:\Users\Jordan.Becker\Desktop\GD\2016_Research\Unemployment_MILEX"
cap cd "\\usnatonetapp01.eur.state.sbu\profiles\beckerjm\Desktop\2016_Research\Unemployment_MILEX"
log using "log\correlates_table8.log", replace


*********************
* Prepare Variables *
*********************
use "dta\2016_02_09_uem", clear
sort ccode year
xtset ccode year


********************
* Analyze the Data *
********************
set more off
sort ccode year
xtset ccode year


*TABLE 8: ECM CORRELATES*
#delimit;

/*milburden*/

/*Baseline*/
#delimit;
reg d.milburden l.milburden l.newatlanticism  d.newatlanticism , cluster(ccode); 
outreg2 using output\Table8_ECM, bdec(3) tdec(3) e(rmse) replace;

/*Public Good*/

reg d.milburden l.milburden d.newatlanticism l.newatlanticism d.ln_full l.ln_full d.ln_pop l.ln_pop, cluster(ccode);
outreg2 using output\Table8_ECM, bdec(3) tdec(3) e(rmse) excel;


/*Threat*/
#delimit ;
reg d.milburden l.milburden d.newatlanticism l.newatlanticism d.ln_full l.ln_full d.ln_pop l.ln_pop  d.threat l.threat  
l.sandler_strategic  , cluster(ccode);
outreg2 using output\Table8_ECM, bdec(3) tdec(3) e(rmse);


#delimit ;
reg d.milburden l.milburden d.newatlanticism l.newatlanticism d.ln_full l.ln_full d.ln_pop l.ln_pop  d.threat l.threat  
l.sandler_strategic   d.right l.right d.dpi_checks l.dpi_checks , cluster(ccode);
outreg2 using output\Table8_ECM, bdec(3) tdec(3) e(rmse);

#delimit ;
reg d.milburden l.milburden d.newatlanticism l.newatlanticism d.ln_full l.ln_full d.ln_pop l.ln_pop  d.threat l.threat  
l.sandler_strategic   d.right l.right d.dpi_checks l.dpi_checks i.year;
outreg2 using output\Table8_ECM, bdec(3) tdec(3) e(rmse) ;

/**********************************************************************************************/

/*operating*/
/*Baseline*/
#delimit;
reg d.operating l.operating l.newatlanticism  d.newatlanticism , cluster(ccode) ;
outreg2 using output\Table8_ECM, bdec(3) tdec(3) e(rmse);

/*Public Good*/

reg d.operating l.operating d.newatlanticism l.newatlanticism d.ln_full l.ln_full d.ln_pop l.ln_pop, cluster(ccode);
outreg2 using output\Table8_ECM, bdec(3) tdec(3) e(rmse);

/*Threat*/
#delimit ;
reg d.operating l.operating d.newatlanticism l.newatlanticism d.ln_full l.ln_full d.ln_pop l.ln_pop  d.threat l.threat  
l.sandler_strategic  , cluster(ccode);
outreg2 using output\Table8_ECM, bdec(3) tdec(3) e(rmse);


/*Domestic Politics*/
#delimit ;
reg d.operating l.operating d.newatlanticism l.newatlanticism d.ln_full l.ln_full d.ln_pop l.ln_pop  d.threat l.threat  
l.sandler_strategic   d.right l.right d.dpi_checks l.dpi_checks , cluster(ccode);
outreg2 using output\Table8_ECM, bdec(3) tdec(3) e(rmse);


/*Year FE*/
#delimit ;
reg d.operating l.operating d.newatlanticism l.newatlanticism d.ln_full l.ln_full d.ln_pop l.ln_pop  d.threat l.threat  
l.sandler_strategic   d.right l.right d.dpi_checks l.dpi_checks i.year , cluster(ccode);
outreg2 using output\Table8_ECM, bdec(3) tdec(3) e(rmse);


*Full Spec Personnel*
#delimit ;
reg d.personnel l.personnel d.newatlanticism l.newatlanticism d.ln_full l.ln_full d.ln_pop l.ln_pop  d.threat l.threat  
l.sandler_strategic   d.right l.right d.dpi_checks l.dpi_checks i.year , cluster(ccode);
outreg2 using output\Table8_ECM, bdec(3) tdec(3) e(rmse);

*Full Spec Equipment*
#delimit ;
reg d.equipment l.equipment d.newatlanticism l.newatlanticism d.ln_full l.ln_full d.ln_pop l.ln_pop  d.threat l.threat  
l.sandler_strategic   d.right l.right d.dpi_checks l.dpi_checks i.year , cluster(ccode);
outreg2 using output\Table8_ECM, bdec(3) tdec(3) e(rmse);

*Full Spec Infrastructure*
#delimit ;
reg d.infrastructure l.infrastructure d.newatlanticism l.newatlanticism d.ln_full l.ln_full d.ln_pop l.ln_pop  d.threat l.threat  
l.sandler_strategic   d.right l.right d.dpi_checks l.dpi_checks i.year , cluster(ccode);
outreg2 using output\Table8_ECM, bdec(3) tdec(3) e(rmse) excel;
